<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title></title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->



<script type="text/javascript"
	src="${pageContext.request.contextPath }/static/js/jquery.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/static/js/EasyUI/jquery.easyui.min.js"></script>
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath }/static/js/EasyUI/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath }/static/js/EasyUI/themes/icon.css">
<script type="text/javascript"
	src="${pageContext.request.contextPath }/static/js/EasyUI/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript"
	src="${pageContext.request.contextPath }/static/js/EasyUI/datagrid-detailview.js"></script>
</head>

<body>

	
	<table id="dg">

	</table>
	<a style="color: red;">PS:笔的图标是编辑选中的文章
	橡皮擦的图标是删除选中的文章</a>
	
	<script type="text/javascript">
		$('#dg')
				.datagrid(
						{
							singleSelect : true,
							width:2000,
							height : 800,
							fitColumns : true,
							pagination : true,
							pageNumber : 1,
							pageSize : 4,
							pageList : [ 4,6 ],
							remoteSort:false,
							nowrap:false,
							url:'${pageContext.request.contextPath}/admin/article/list.do',
							columns:[[
								{field: 'cb', checkbox: true },  
								{field:'articleId',title:'文章编号',width:50,height:10},
								{field:'articleName',title:'文章名称',width:100},
								{field:'articleTime',title:'发布日期',width:100},
								{field:'articleSummary',title:'简介',width:100},
								{field:'clickhit',title:'点击数',width:100},
								{field:'articleImg',title:'对应的图片',width:100},
							]],

							toolbar : [
									{
										iconCls : 'icon-edit',
										handler : function() {
											var selectRows = $("#dg").datagrid(
													"getSelections");
											if(selectRows.length==0)
											{
												alert("系统提示:请选择要编辑的的行数");
											}
											window.location.href = "${pageContext.request.contextPath}/admin/editorUI.do?articleId="+ selectRows[0].articleId;
										}
									}, '-', {
										iconCls : 'icon-remove',
										handler : function() {
											var selectRows = $("#dg").datagrid("getSelections");
											if(selectRows.length==0)
											{
				
												alert("系统提示:请选择要删除的的行数");
											}
											else
											{
												if(window.confirm('你确认需要删除吗？'))
												{
													window.location.href = "${pageContext.request.contextPath}/admin/article/delete.do?articleId="+ selectRows[0].articleId;
												}
												else
												{
												}
											}
										}
									} ],
									detailFormatter: function(rowIndex, rowData){
										 return '<div style="padding:2px"><table id="ddv-' + index + '"></table></div>';
									}
						});
	</script>
</body>
</html>
